 <template>
   <div >
  <el-table :data="tableData" style="width: 100%" height="725px">
    <el-table-column prop="projectName" label="项目名" width="240"></el-table-column>
    <el-table-column prop="workroomName" label="工作室名"  width="240"></el-table-column>
    <el-table-column prop="price" label="报价"  width="150"></el-table-column>
    <el-table-column prop="timeLimit" label="工期"  width="150"></el-table-column>
    <el-table-column prop="styles" label="类型"  width="150"></el-table-column>
    <el-table-column label="操作"  width="500">
      <template slot-scope="scope">
        <el-button
          size="small "
          @click="handleEdit(scope.$index, scope.row)">联系工作室</el-button>
        <el-button v-if="scope.row.style===0"
          size="small "
          @click="jump(scope.row.id)">项目任务分配</el-button>
        <!--<el-button-->
          <!--v-if="scope.row.style===0"-->
          <!--size="small "-->
          <!--@click="jumpp(scope.row.id)">项目进度管理</el-button>-->
        <el-button
          v-if="scope.row.style===1"
          size="small "
          @click="jumpp(scope.row.id)">项目进度反馈</el-button>
        <el-button
          v-if="scope.row.style===1"
          size="small "
          @click="jumpp(scope.row.id)">工作位置信息录入</el-button>
        <el-button
          size="small "
          type="danger"
          @click="handleDelete(scope.$index, scope.row)">确认项目完成</el-button>
      </template>
    </el-table-column>
  </el-table>





       <!-- Form -->
       <!--<el-button type="text" @click="dialogFormVisible = true"> Dialog</el-button>-->

       <el-dialog title="评价" :visible.sync="dialogFormVisible">
         <div class="block">
           <span class="demonstration">请为本次项目评分</span>
           <el-rate
             v-model="value2"
             :colors="colors">
           </el-rate>
         </div>
         <div slot="footer" class="dialog-footer">
           <el-button @click="dialogFormVisible = false">取 消</el-button>
           <el-button type="primary" @click="hh">确 定</el-button>
         </div>
       </el-dialog>
     </div>












 </template>

<script>
  export default {
    data() {
      return {
        value2: null,
        colors: ['#99A9BF', '#F7BA2A', '#FF9900'],
        dialogFormVisible: false,
        form: {
          name: '',
          region: '',
          date1: '',
          date2: '',
          delivery: false,
          type: [],
          resource: '',
          desc: ''
        },
        formLabelWidth: '120px',
        tableData: [
          {
            id:'',
            wid:'',
            pid:'',
            cid:'',
            projectName:'',
            workroomName:'',
            price:'',
            timeLimit:'',
            styles:'',
            style:''

          }
        ]
      }
    },
    mounted: function(){
      var user= JSON.parse(window.sessionStorage.getItem("user"));
      var ff=user.id
      axios.post('/company/findProjecting',{
        id : ff,
        idd:ff
      }).then((response) => {
        if( response.data !=null){
          this.$notify({
            title: '成功',
            message: '成功',
            type: 'success',
            duration:2000
          });
          var e=response.data
          console.log(e)
          var data=[];
          var jjjj=0
          for(var c=0;c<e.length;c++){
            var ee=e[c];
            if(ee.states==0||ee.states==1||ee.states==2||ee.states==3){
            var obj={}
            obj.id=ee.id
            obj.states=ee.states
            obj.wid=ee.wid
            obj.pid=ee.pid
            obj.cid=ee.id
            obj.projectName=ee.projectName
            obj.workroomName=ee.photoUrl
            obj.price=ee.price
            obj.style=ee.style
            var hh= ee.timeLimit
            var hhh=hh.split("T")
            obj.timeLimit=hhh[0]
            var hhh=ee.style
            if(hhh==0){
             obj.styles="项目外包"
            }else{
              obj.styles="人员内包"
            }
            data[jjjj]=obj
             jjjj++
          }}
          console.log(data)
          this. tableData=data


        }
        else{
          this.$notify({
            title: '失败',
            message: '错误',
            type: 'warning',
            duration:2000
          });
        }
      })

    },
    methods: {

      hh(){


        var id=27
        axios.post('/company/WorkroomGrade',{
          id :id,
          grade:this.value2
        }).then((response) => {
          if(response.data!=""){


            console.log("aaaaaaaaaa");
            var ff=7
            axios.post('/company/finshOrder',{
              id : ff,
              idd  : ff
            }).then((response) => {
              if( response.data.states== 800){
                this.$notify({
                  title: '成功',
                  message: '成功',
                  type: 'success',
                  duration:2000
                });
                location.reload()
              }
              else{
                this.$notify({
                  title: '失败',
                  message: '错误',
                  type: 'warning',
                  duration:2000
                });
              }
            })





          }
          else{
            // this.$notify.error({
            //   title: '项目未被找到',
            //   message: response.data.message,
            //   type: 'warning',
            //   duration:0
            // });
          }

        }).catch((response)=>{
          this.$notify.error({
            title: '',
            message: '错误'
          });
        })






        this. dialogFormVisible = false


      },
      handleEdit(index, row) {

        // this.fid = this.$route.query.
        // this.tid = this.$route.query.tid
        // this.fname = this.$route.query.name
        var user= JSON.parse(window.sessionStorage.getItem("user"));



        var ee=user.id
        // var ff=row.pid
        this.$router.push({
          path: '/SendMassage',
          query: {
            tid:26,
            fid:25,
            name:"ooooo"
          }
        })

      },
      jump(path){
        this.$router.push({
          path: '/Echart',
          query: {
            mallCode: path
          }
        })

      },

      jumpp(path){
        this.$router.push({
          path: '/BaiduMap',
          query: {
            mallCode: path
          }
        })

      },
      handleDelete(index, row) {

        this.dialogFormVisible = true
       // this.hh(row)



      }

    }

  }
</script>



<style scoped>

</style>
